{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3 this error is 275.838\n",
      "4 this error is 92.8608\n",
      "5 this error is 127.998\n",
      "6 this error is 107.049\n",
      "7 this error is 48.2886\n",
      "8 this error is 14.4948\n",
      "9 this error is 11.7235\n"
     ]
    }
   ],
   "source": [
    "a = \"\"\"3 this error is 275.838\n",
    "4 this error is 92.8608\n",
    "5 this error is 127.998\n",
    "6 this error is 107.049\n",
    "7 this error is 48.2886\n",
    "8 this error is 14.4948\n",
    "9 this error is 11.7235\"\"\"\n",
    "\n",
    "\n",
    "import re\n",
    "\n",
    "data = [] \n",
    "for i in a.split('\\n') :\n",
    "    print(i)\n",
    "    matchObj = re.search( '(.*) this error is (.*)',i,re.M|re.I)\n",
    "    if matchObj:\n",
    "        a = matchObj.group(1)\n",
    "        b = matchObj.group(2)\n",
    "        data.append([a,b])\n",
    "    else:\n",
    "        print(\"No match!!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "b = \"\"\"\n",
    "3 this error is 24.1149\n",
    "4 this error is 2.58916\n",
    "5 this error is 1.3714\n",
    "6 this error is 4.82805\n",
    "7 this error is 3.83839\n",
    "8 this error is 2.1413\n",
    "9 this error is 1.13414\n",
    "10 this error is 1.05438\n",
    "11 this error is 0.913206\n",
    "12 this error is 0.793168\n",
    "13 this error is 0.660236\n",
    "14 this error is 0.834865\"\"\"\n",
    "\n",
    "import re\n",
    "\n",
    "data1 = [] \n",
    "for i in b.split('\\n') :\n",
    "    print(i)\n",
    "    matchObj = re.search( '(.*) this error is (.*)',i,re.M|re.I)\n",
    "    if matchObj:\n",
    "        a = matchObj.group(1)\n",
    "        b = matchObj.group(2)\n",
    "        data1.append([a,b])\n",
    "    else:\n",
    "        print(\"No match!!\")\n",
    "print(data1)        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "import plotly.graph_objects as go\n",
    "import numpy as np \n",
    "\n",
    "a = np.array(data) \n",
    "b = np.array(data1) \n",
    "\n",
    "fig = go.Figure()\n",
    "\n",
    "fig.add_trace(go.Scatter(\n",
    "    x=a[:,0],\n",
    "    y=a[:,1],\n",
    "    name='10 sampling points',\n",
    "))\n",
    "\n",
    "fig.add_trace(go.Scatter(\n",
    "    x=a[:,0],\n",
    "    y=a[:,1],\n",
    "    name='10 sampling points',\n",
    "))\n",
    "\n",
    "fig.write_image(\"fig1.svg\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "No match!!\n",
      "3 this error is 24.1149\n",
      "4 this error is 2.58916\n",
      "5 this error is 1.3714\n",
      "6 this error is 4.82805\n",
      "7 this error is 3.83839\n",
      "8 this error is 2.1413\n",
      "9 this error is 1.13414\n",
      "10 this error is 1.05438\n",
      "11 this error is 0.913206\n",
      "12 this error is 0.793168\n",
      "13 this error is 0.660236\n",
      "14 this error is 0.834865\n",
      "[['3', '24.1149'], ['4', '2.58916'], ['5', '1.3714'], ['6', '4.82805'], ['7', '3.83839'], ['8', '2.1413'], ['9', '1.13414'], ['10', '1.05438'], ['11', '0.913206'], ['12', '0.793168'], ['13', '0.660236'], ['14', '0.834865']]\n"
     ]
    }
   ],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
